<template>
	<el-container>
		<el-header>密码重置</el-header>
		<el-main>
			<el-form :model="reset" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" style="padding-top:40px;
			padding-right:30px;
			padding-bottom:30px;
			margin-top:100px; 
			width: 40%; 
			margin-left:30%; 
			border-radius: 4px; 
			box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)">  
				<el-form-item label="账号" prop="account">
					<el-input v-model="reset.account" placeholder="请输入账号" clearable></el-input>
				</el-form-item>
				<el-form-item label="新密码" prop="password">
					<el-input v-model="reset.password" placeholder="请牢记密码" show-password></el-input>
				</el-form-item>
				<el-form-item label="确认密码" prop="type">
					<el-input v-model="reset.ensurepassword" placeholder="请重复输入密码" show-password></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" style="width:25%" @click="open1()" plain="true">确定重置
					</el-button>
				</el-form-item>
			</el-form>
		</el-main>
		<el-footer>
			<el-row :gutter=" 20">
				<el-col :span="4">
					<div class="grid-content bg-purple1">
						<el-button>返回主界面</el-button>
					</div>
				</el-col>
				<el-col :span="16">
					<div class="grid-content bg-purple1" align="center"></div>
				</el-col>
				<el-col :span="4">
					<div class="grid-content bg-purple1">
					</div>
				</el-col>
			</el-row>
		</el-footer>
	</el-container>
</template>

<script>
	import {
		showMsgTitle
	} from '@/utils/api2'
	import {
		showMsgConfirm
	} from '@/utils/api2'
	import {
		getRequest
	} from '@/utils/api2'
	import {
		postRequest
	} from '@/utils/api2'
	export default {
		data() {
			return {
				reset: {
					account: '',
					ensurepassword: '',
					password: ''
				}
			}
		},
		mounted: function() {
		var tel = this.$route.query.tel;
		console.log(this.$route.query.type);			
		this.reset.account=tel;
		},
		methods: {
			open1() {
				
				let url = "/queryPatient";
				getRequest(url).then(resp => {
					//postRequest('/updataPatient', this.test);
						for (var i = 0; i < resp.data.length; i++) {
				
							if (this.reset.account == resp.data[i].tel) {
								resp.data[i].password=this.reset.password;
								postRequest('/updataPatient', resp.data[i]);								
							}
						}
				})
				this.$message({
					message: '重置成功！',
					type: 'success'
				})
			}
		}
	}
</script>
<style>
	.el-footer {
		background-color: #4FC1B0;
		color: #333;
		text-align: center;
		line-height: 60px;
		border-radius: 10px;
	}

	.el-header {
		text-align: left;
		font-size: 40px;
		color: #ffffff;
		border-radius: 10px;
		background-color: #4FC1B0;
	}

	.el-main {
		background-color: #ffffff;
		color: #333;
		text-align: center;
		height: 610px;
	}

	.el-row {
		margin-bottom: 20px;

		&:last-child {
			margin-bottom: 0;
		}
	}

	.el-col {
		border-radius: 4px;
	}


	.bg-purple {
		background: #ffffff;
	}

	.bg-purple1 {
		background: #4FC1B0;
	}

	.grid-content {
		border-radius: 4px;
		min-height: 50px;
		font-size: 24px;
	}

	.grid-content1 {
		border-radius: 4px;
		min-height: 160px;

	}
</style>
